package com.jifeng.api.wxpay.controller;

import com.jifeng.api.utils.R;
import com.jifeng.api.vo.ReqWxPayVo;
import com.jifeng.api.wxpay.service.WXPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/****************************************************
 *
 *
 *
 * @author majker
 * @date 2019-03-07 21:21
 * @version 1.0
 **************************************************/

@RestController
@RequestMapping("terminal/rent")
@Slf4j
public class WXPayController {

    @Autowired
    WXPayService wxPayService;

    /**
     * 微信支付（租赁）
     */
    @PostMapping(value = "/wxpay")
    public R order(@RequestBody ReqWxPayVo params) throws Exception {
        R rs = wxPayService.wxPay(params);
        return rs;
    }

    /**
     * 微信支付（租赁完成）
     */
    @PostMapping(value = "/bill/wxpay")
    public R pay(@RequestBody ReqWxPayVo params) throws Exception {
        R rs = wxPayService.pay(params);
        return rs;
    }

    /**
     * 获取openId
     */
    @PostMapping(value = "/wxpay/openid/get")
    public R getOpenId(@RequestBody Map<String,Object> params) throws Exception {
        R rs = wxPayService.getOpenId(params);
        return rs;
    }
}



